﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Ajeelee.Core.Utils;
using BoCaiWeb.Business;
using BoCaiWeb.Model;
using BoCaiWeb.WebSite.Code;

namespace BoCaiWeb.WebSite
{
    public partial class productinfo : PageBase
    {
        protected int id;
        protected Products info;
        IProductsBusiness productsBll = new ProductsBusinessFactory().CreateProductsBusiness();

        protected void Page_Load(object sender, EventArgs e)
        {
            // 获取参数
            id = QueryParamInt32("id");

            if (id > 0)
            {
                try
                {
                    // 读取新闻信息
                    info = productsBll.GetById(id);
                    if (info != null)
                    {
                        // 点击统计
                        Hashtable table = new Hashtable();
                        table.Add(ProductsHash.Id, id);
                        table.Add(ProductsHash.Count, info.Count + 1);
                        productsBll.UpdateSomeVal(table);
                    }
                }
                catch (Exception ex)
                {
                    Function.WriteErrorLog(ex);
                }
            }
            if (info == null)
            {
                info = new Products();
                Page_GoTo("404.aspx");
            }
        }
    }
}